package com.esd.crm.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.esd.crm.entity.User;
import com.esd.crm.mapper.UserMapper;
import com.esd.crm.service.UserService;

@Service
public class UserServiceImpl implements UserService{
	@Autowired
	private UserMapper mapper;

	@Override
	public int deleteByPrimaryKey(Integer userId) {
		return mapper.deleteByPrimaryKey(userId);
	}

	@Override
	public int insert(User record) {
		return mapper.insert(record);
	}

	@Override
	public int insertSelective(User record) {
		return mapper.insertSelective(record);
	}

	@Override
	public User selectByPrimaryKey(Integer userId) {
		return mapper.selectByPrimaryKey(userId);
	}

	@Override
	public int updateByPrimaryKeySelective(User record) {
		return mapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(User record) {
		return mapper.updateByPrimaryKey(record);
	}

	public List<User> selectAll(int page, int totle) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("page", page);
		map.put("totle", totle);
		return mapper.selectAll(map);
	}

	@Override
	public int selectCount() {
		// TODO Auto-generated method stub
		return mapper.selectCount();
	}

	@Override
	public User selectByName(String name) {
		// TODO Auto-generated method stub
		return mapper.selectByName(name);
	}

}
